package com.android.baseconfig.data.http.okhttp.util;

import android.app.Activity;

import java.io.Serializable;

/**
 * Created by uuxia-mac on 16/7/10.
 */
public class OkHttpTag implements Serializable, Cloneable {
    private Activity activity = null;
    private Object tag;
    private boolean needProgressBar = true;
    private String showMsg = null;
    private String path;

    public OkHttpTag(String path) {
        this.path = path;
    }

    public OkHttpTag(Activity activity, Object tag, boolean needProgressBar, String showMsg) {
        this.activity = activity;
        this.tag = tag;
        this.needProgressBar = needProgressBar;
        this.showMsg = showMsg;
    }

    public OkHttpTag(Activity activity, boolean needProgressBar, String showMsg) {
        this.activity = activity;
        this.needProgressBar = needProgressBar;
        this.showMsg = showMsg;
    }

    public OkHttpTag(boolean needProgressBar, String showMsg) {
        this.needProgressBar = needProgressBar;
        this.showMsg = showMsg;
    }

    public OkHttpTag(Object tag, boolean needProgressBar) {
        this.tag = tag;
        this.needProgressBar = needProgressBar;
    }

    public OkHttpTag(Object tag, boolean needProgressBar, String showMsg) {
        this.tag = tag;
        this.needProgressBar = needProgressBar;
        this.showMsg = showMsg;
    }

    public Object getTag() {
        return tag;
    }

    public void setTag(Object tag) {
        this.tag = tag;
    }

    public boolean isNeedProgressBar() {
        return needProgressBar;
    }

    public void setNeedProgressBar(boolean needProgressBar) {
        this.needProgressBar = needProgressBar;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public Activity getActivity() {
        return activity;
    }

    public void setActivity(Activity activity) {
        this.activity = activity;
    }

    public String getShowMsg() {
        return showMsg;
    }

    public void setShowMsg(String showMsg) {
        this.showMsg = showMsg;
    }

    public boolean canShowDialog() {
        return needProgressBar && activity != null;
    }

    @Override
    public String toString() {
        return "OkHttpTag{" +
                "tag=" + tag +
                ", needProgressBar=" + needProgressBar +
                ", showMsg='" + showMsg + '\'' +
                '}';
    }

    @Override
    public OkHttpTag clone() {
        OkHttpTag o = null;
        try {
            o = (OkHttpTag) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        return o;
    }
}
